﻿<UserControl
    x:Class="ReloadData.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
    xmlns:uriMapper="clr-namespace:System.Windows.Navigation;assembly=System.Windows.Controls.Navigation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="832" d:DesignHeight="453" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:ReloadData.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">

    <Grid x:Name="LayoutRoot" Style="{StaticResource LayoutRootGridStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="444*" />
            <RowDefinition Height="36*" />
        </Grid.RowDefinitions>
        <Border x:Name="ContentBorder" Style="{StaticResource ContentBorderStyle}" Margin="0,42,0,0" Grid.RowSpan="2">

            <navigation:Frame x:Name="ContentFrame" Style="{StaticResource ContentFrameStyle}" 
                              Source="{Binding Mode=OneWay, ElementName=categoryDomainDataSource, Path=Data}" Navigated="ContentFrame_Navigated" NavigationFailed="ContentFrame_NavigationFailed" Height="408" Width="832">
                <navigation:Frame.UriMapper>
                  <uriMapper:UriMapper>
                    <uriMapper:UriMapping Uri="" MappedUri="/Views/Home.xaml"/>
                    <uriMapper:UriMapping Uri="/{pageName}" MappedUri="/Views/{pageName}.xaml"/>
                  </uriMapper:UriMapper>
                </navigation:Frame.UriMapper>
            </navigation:Frame>
        </Border>

        <Grid x:Name="NavigationGrid" Style="{StaticResource NavigationGridStyle}">

            <Border x:Name="BrandingBorder" Style="{StaticResource BrandingBorderStyle}">
                <StackPanel x:Name="BrandingStackPanel" Style="{StaticResource BrandingStackPanelStyle}">

                    <ContentControl Style="{StaticResource LogoIcon}"/>
                    <TextBlock x:Name="ApplicationNameTextBlock" Style="{StaticResource ApplicationNameStyle}" 
                               Text="Application Name"/>

                </StackPanel>
            </Border>

            <Border x:Name="LinksBorder" Style="{StaticResource LinksBorderStyle}">
                <StackPanel x:Name="LinksStackPanel" Style="{StaticResource LinksStackPanelStyle}">

                    <HyperlinkButton x:Name="Link1" Style="{StaticResource LinkStyle}" 
                                     NavigateUri="/Home" TargetName="ContentFrame" Content="home"/>
									 
                    <Rectangle x:Name="Divider1" Style="{StaticResource DividerStyle}"/>
					
                    <HyperlinkButton x:Name="Link2" Style="{StaticResource LinkStyle}" 
                                     NavigateUri="/About" TargetName="ContentFrame" Content="about"/>

                </StackPanel>
            </Border>

        </Grid>
        
        <sdk:DataGrid AutoGenerateColumns="True" Height="230" HorizontalAlignment="Left" 
                      Margin="25,167,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="388" 
                      ItemsSource="{Binding ElementName=categoryDomainDataSource, Path=Data}" />
        
        <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:Category, CreateList=true}" Height="0" LoadedData="categoryDomainDataSource_LoadedData_1" Name="categoryDomainDataSource" QueryName="GetCategoriesQuery" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my:NorthwindDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        
        </riaControls:DomainDataSource>
        <Button Content="Refresh" Height="23" HorizontalAlignment="Left" Margin="338,121,0,0" Name="refrBtn" VerticalAlignment="Top" Width="75" Click="refrBtn_Click" />
        <sdk:DataPager Height="26" Source="{Binding ElementName=categoryDomainDataSource, Path=Data}" HorizontalAlignment="Left" Margin="26,403,0,0" Name="dataPager1" PageSize="5" VerticalAlignment="Top" Width="387" Grid.RowSpan="2" />
        <sdk:DataGrid AutoGenerateColumns="True" Height="230" HorizontalAlignment="Left" Margin="433,167,0,0" Name="myGrid" VerticalAlignment="Top" Width="328" />
        <sdk:DataPager Grid.RowSpan="2" Height="26" HorizontalAlignment="Left" 
                       Margin="501,403,0,0" Name="myGridDP" PageSize="10"
                       Source="{Binding ElementName=myGrid, Path=ItemsSource}"
                       VerticalAlignment="Top" Width="200" />
    </Grid>

</UserControl>